package zjitc.link;

import org.junit.Test;

import java.util.Scanner;

public class NodeTest {
    @Test
    public void test(){
        int size=0;
        Node first=new Node<Student>(new Student("01","A"));
        Node last=first;
        size++;

        last.next=new Node<Student>(new Student("02","B"));
        last=last.next;
        size++;

        last.next=new Node<Student>(new Student("03","C"));
        last=last.next;
        size++;

        //查找第i个（索引2）节点的学生信息

//        Node<Student>p=first;
//        int index=0;
//        while (index<2 && p.next!=null){
//            p=p.next;
//            index++;
//        }
        //随机索引,随机一个索引，当前索引插入学生  001
        int index;
        Scanner scanner=new Scanner(System.in);
        index =scanner.nextInt();
        //判断越界
        if (index<0||index>=size){
            throw new RuntimeException("插入位置越界");
        }
//        //查找
//        Node<Student>p=first;
//        for (int i=0;i<index;i++){
//            p=p.next;
//        }
        if (index == size){
            //最后 last
        }else if(index==0){
            //最前 first
        }else {
            //中间
        }


        System.out.println();
    }
}
